PIC microcontroller not working without PICKIT3
You really need to read the help on how to ask a better question.

For best results post a small but complete example application that show exactly how you have initialized your PIC18F45K50 with a simple demo application like a GPIO pin toggle. 

A description of this is in your question the only thing missing is how you did your PIC setup.

Creating this kind of example for someone new to Microchips MPLABX tool chain this is an almost impossible task.

Developers that use the Microchip MCC (MPLAB Code Configurator) tool find that the generate code is too complex to post here as an example.

This is the kind of example you should post here:

    /*
     * file: main.c
     * target: PIC18LF45K50
     * IDE: MPLABX v5.10
     * Compiler: XC8 v1.45
     *
     *                           PIC18LF45K50
     *                    +---------:_:---------+
     * 10K pull-up RE3 -&gt; :  1 VPP       PGD 40 : &lt;&gt; RB7
     *             RA0 &lt;&gt; :  2           PGC 39 : &lt;&gt; RB6
     *         LED RA1 &lt;&gt; :  3               38 : &lt;&gt; RB5
     *             RA2 &lt;&gt; :  4               37 : &lt;&gt; RB4
     *             RA3 &lt;&gt; :  5               36 : &lt;&gt; RB3
     *             RA4 &lt;&gt; :  6               35 : &lt;&gt; RB2
     *             RA5 &lt;&gt; :  7               34 : &lt;&gt; RB1
     *             RE0 &lt;&gt; :  8          INT0 33 : &lt;&gt; RB0
     *             RE1 &lt;&gt; :  9               32 : &lt;- VDD 3v3
     *             RE2 &lt;&gt; : 10               31 : &lt;- VSS GND
     *         3v3 VDD -&gt; : 11               30 : &lt;&gt; RD7
     *         GND VSS -&gt; : 12               29 : &lt;&gt; RD6
     *             RA7 &lt;&gt; : 13 OSC1          28 : &lt;&gt; RD5
     *             RA6 &lt;&gt; : 14 OSC2          27 : &lt;&gt; RD4
     *             RC0 &lt;&gt; : 15 SOSCO         26 : &lt;&gt; RC7
     *             RC1 &lt;&gt; : 16 SOSCI         25 : &lt;&gt; RC6
     *             RC2 &lt;&gt; : 17 CCP1          24 : &lt;&gt; D+
     *        3v3 VUSB -&gt; : 18               23 : &lt;&gt; D-
     *             RD0 &lt;&gt; : 19               22 : &lt;&gt; RD3
     *             RD1 &lt;&gt; : 20               21 : &lt;&gt; RD2
     *                    +---------------------+
     *                            DIP-40
     *        
     * Description:
     * 
     * This applicaiton toggles the RA1 output hight for 250 millseconds then low for 250 millseconds.
     * 
     * See: https://electronics.stackexchange.com/questions/417447/pic-microcontroller-not-working-without-pickit3
     * 
     * The circuit does not have much going on,Power supply and Pull up resistor 
     * is connected and Pin-3 is supposed to give out pulses. Configured to work 
     * with internal oscillator. MCLR pin is pulled up with 10K resistor.
     */
    #include &lt;xc.h&gt;
    /*
     * PIC configuration words
     */
    #pragma config PLLSEL = PLL3X, CFGPLLEN = ON, CPUDIV = NOCLKDIV
    #pragma config LS48MHZ = SYS48X8, FOSC = INTOSCIO, PCLKEN = OFF
    #pragma config FCMEN = OFF, IESO = OFF, nPWRTEN = OFF, BOREN = OFF
    #pragma config BORV = 190, nLPBOR = OFF, WDTEN = SWON, WDTPS = 32768
    #pragma config CCP2MX = RC1, PBADEN = OFF, T3CMX = RC0, SDOMX = RB3
    #pragma config MCLRE = ON, STVREN = ON, LVP = OFF, ICPRT = OFF
    #pragma config XINST = OFF
    #pragma config CP0 = OFF, CP1 = OFF, CP2 = OFF, CP3 = OFF
    #pragma config CPB = OFF, CPD = OFF
    #pragma config WRT0 = OFF, WRT1 = OFF, WRT2 = OFF, WRT3 = OFF
    #pragma config WRTC = OFF, WRTB = OFF, WRTD = OFF
    #pragma config EBTR0 = OFF, EBTR1 = OFF, EBTR2 = OFF, EBTR3 = OFF
    #pragma config EBTRB = OFF

    /*
     * Constants Definition
     */
    #define _XTAL_FREQ (48000000UL)
    /*
     * Main application
     */
    void main( void )
    {
        INTCON = 0;             /* Disable all interrupt sources */
        PIE1 = 0;
        PIE2 = 0;
        INTCON3bits.INT1IE = 0;
        INTCON3bits.INT2IE = 0;

        OSCCON = 0x70;          /* set internal oscillator to 16MHz */

        /*
         * Application loop
         */
        ANSELAbits.ANSA1 = 0; /* make RA1 digital I/O    */
        TRISAbits.TRISA1 = 0; /* make RA1 digital output */
        LATAbits.LATA1   = 0; /* make RA1 output low     */
        for(;;)
        {
            LATAbits.LATA1   ^= 1; /* toggle RA1 output  */
            __delay_ms(250);
        }
    }


This is a complete application that has no dependency on any peripheral library code. The functionality described in your question is implemented. Unless there is a fault with how you have wired up your circuit this code should work with and without the PICkit3 connected.