Why do we need a pull-up resistor when there is a floating connection at the base of a transistor?
1) the output of the PIC will be floating (after reset) until the output is properly initialized by the software.

2) Strictly for a bipolar transistor you would not need such a resistor. When the base is floating the transistor will be OFF. However it is good practice to (pre) define floating inputs (the base of a transistor is an input) and usually a high-value resistor is used to switch the transistor OFF. A 10 k ohm resistor between Base and emitter will do that.

If you use a MOS transistor then you MUST always place such a resistor as the gate of a MOS transistor is isolated and can store a charge which will turn on the transistor untill you remove the charge. I always use a 1 Meg ohm to connect the gate such that the transistor will be OFF untill the microcontroller sets the gate voltage.